<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h3></h3>
    <script>
        function ajax(url,callback,method='get') {
            let x = new XMLHttpRequest();
            x.open(method, url);
            x.send();
            x.responseType = 'json';
            x.onreadystatechange = function () {
                if (x.readyState === 4) {
                    if (x.status >= 200 && x.status < 300) {
                        let obj = x.response;
                        callback(obj)
                    }
                }
            }
        }
        ajax('https://v1.hitokoto.cn/?c=a',function(obj){
            // alert(123);
            document.querySelector('h3').innerHTML = obj.hitokoto;
        });
    </script>
</body>

</html>